package com.fwzc.giuseppe.activity;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.fwzc.giuseppe.R;
import com.fwzc.giuseppe.Api.Api;
import com.fwzc.giuseppe.adapter.HolderAdapter;
import com.fwzc.giuseppe.base.BaseActivity;

/**
 * 确认订单
 * 
 * */
public class ConfirmationOrder extends BaseActivity implements OnClickListener{
	private Context context = ConfirmationOrder.this;
	HolderAdapter<HashMap<String,String>> mAdapter;
	private List<HashMap<String, String>> data = new ArrayList<HashMap<String, String>>();
	TextView tv_name,tv_phone,tv_address,tv_zipcode;
	private String name,phone,address,zipcode;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.confirmation_order);
		initBar();
		actionbar_side_name.setText("确认订单");
		bg_actionbar_side.setBackgroundColor(getResources().getColor(R.color.transparent));
		iv_actionbar_side_left.setVisibility(View.VISIBLE);
		iv_actionbar_side_left.setOnClickListener(this);
		initView();
	}
	private void initView() {
		// TODO Auto-generated method stub
		Intent intent = getIntent();
		name = intent.getStringExtra("name");
		phone = intent.getStringExtra("phone");
		address = intent.getStringExtra("address");
		zipcode = intent.getStringExtra("zipcode");

		tv_name = (TextView) findViewById(R.id.tv_name);
		tv_phone = (TextView) findViewById(R.id.tv_phone);
		tv_address = (TextView) findViewById(R.id.tv_address);
		tv_zipcode = (TextView) findViewById(R.id.tv_zipcode);
		
		
		LinearLayout id_address = (LinearLayout) findViewById(R.id.id_address);
		id_address.setOnClickListener(this);
		
		Button topay = (Button) findViewById(R.id.topay);
		topay.setOnClickListener(this);
		createAdapter();
		if (Api.false_data) {
			setFalseData();
		} else {

			loadingaddress();
			
		}
	}
	private void createAdapter() {
		// TODO Auto-generated method stub
		
	}
	private void loadingaddress() {
		// TODO Auto-generated method stub
		
	}
	private void setFalseData() {
		tv_name.setText(name);
		tv_phone.setText(phone);
		tv_address.setText(address);
		tv_zipcode.setText(zipcode);

		
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		// 返回
		case R.id.iv_actionbar_side_left:
			finish();
			break;
			
		case R.id.id_address:
			startActivity(new Intent(context, SelectAddress.class));
			break;

		case R.id.topay:
			startActivity(new Intent(context, PayActivity.class));
			break;
		default:
			break;
		}
		
	}

}
